package org.jash.learnmvp.user;

import org.jash.learnmvp.entity.CodeEntity;
import org.jash.learnmvp.entity.Res;
import org.jash.learnmvp.mvp.BaseModel;

import java.util.HashMap;

import io.reactivex.rxjava3.core.Observable;

public class RegisterModel extends BaseModel implements ConStruct.IRegisterModel {
    @Override
    public Observable<CodeEntity> getRCode(String phone) {
        return service.getRCode(phone);
    }

    @Override
    public Observable<Res> register(String username, String password, String phone) {
        return service.register(new HashMap<String, String>() {{
            put("username", username);
            put("password", password);
            put("phone", phone);
        }});
    }

    @Override
    public Observable<Res> verify(String phone, String code) {
        return service.verifyRegister(new HashMap<String, String>() {{
            put("phone", phone);
            put("code", code);
        }});
    }
}
